package me.leiusual.sharing.repository.datasource

import androidx.lifecycle.MutableLiveData
import androidx.paging.DataSource
import me.leiusual.sharing.api.ApiSharing
import me.leiusual.sharing.api.model.orderlist.Content

/**
 * author: leiusual
 * create on: 2019-07-31
 * description:
 */
class OrderDataSourceFactory(
    private val apiSharing: ApiSharing,
    private val storeId: Long,
    private val keyword: String,
    private val status: Int
) : DataSource.Factory<Int, Content>() {

  val orderDataSource = MutableLiveData<OrderDataSource>()

  override fun create(): DataSource<Int, Content> {
    val dataSource = OrderDataSource(apiSharing, storeId, keyword, status)
    orderDataSource.postValue(dataSource)
    return dataSource
  }
}